<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>概要 - Powered by MinDoc</title>

    <!-- Bootstrap -->
    <link href="${request.contextPath}/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${request.contextPath}/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <link href="${request.contextPath}/css/main.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="${request.contextPath}/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="${request.contextPath}/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="manual-reader">
    <#include "../widgets/header.ftl">
    <div class="container manual-body">
        <div class="row">
            <div class="page-left">
                <ul class="menu">
                    <li class="active"><a href="${request.contextPath}/book/${Model.identify}/dashboard" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 概要</a> </li>
                    <li><a href="${request.contextPath}/book/${Model.identify}/users" class="item"><i class="fa fa-users" aria-hidden="true"></i> 成员</a> </li>
                    <#if Model.roleId == 0 || Model.roleId == 1>
                    <li><a href="${request.contextPath}/book/${Model.identify}/setting" class="item"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a> </li>
                    </#if>
                </ul>

            </div>
            <div class="page-right">
                <div class="m-box">
                    <div class="box-head">
                        <strong class="box-title">
                            <#if Model.privatelyOwned == 0>
                            <i class="fa fa-unlock" aria-hidden="true" title="公开项目" data-toggle="tooltip"></i>
                            <#else>
                            <i class="fa fa-lock" aria-hidden="true" title="私有项目" data-toggle="tooltip"></i>
                            </#if>
                            ${Model.bookName}
                        </strong>
                        <#if Model.roleId == 3>
                        <a href="{{urlfor "DocumentController.Edit" ":key" .Model.Identify ":id" ""}}" class="btn btn-default btn-sm pull-right" target="_blank"><i class="fa fa-edit" aria-hidden="true"></i> 编辑</a>
                        </#if>
                        <a href="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" class="btn btn-default btn-sm pull-right" style="margin-right: 5px;" target="_blank"><i class="fa fa-eye"></i> 阅读</a>

                        <#if Model.roleId == 0 || Model.roleId == 1 || Model.roleId == 2>
                        <button class="btn btn-default btn-sm pull-right" style="margin-right: 5px;" id="btnRelease"><i class="fa fa-upload" aria-hidden="true"></i> 发布</button>
                        </#if>
                    </div>
                </div>
                <div class="box-body">
                    <div class="dashboard">
                        <div class="pull-left" style="width: 200px;margin-bottom: 15px;">
                            <div class="book-image">
                                <img src="${request.contextPath}${Model.cover}" onerror="this.src='${request.contextPath}/images/book.jpg'" style="border: 1px solid #666;width: 175px;">
                            </div>
                        </div>

                            <div class="list">
                                <span class="title">创建者：</span>
                                <span class="body">${Model.createName}</span>
                            </div>
                            <div class="list">
                                <span class="title">文档数量：</span>
                                <span class="body">${Model.docCount} 篇</span>
                            </div>
                            <div class="list">
                                <span class="title">创建时间：</span>
                                <span class="body"> ${Model.createTime?string("yyyy-MM-dd HH:mm:ss")} </span>
                            </div>
                            <div class="list">
                                <span class="title">修改时间：</span>
                                <span class="body"> ${Model.modifyTime?string("yyyy-MM-dd HH:mm:ss")} </span>
                            </div>
                        <div class="list">
                            <span class="title">担任角色：</span>
                            <span class="body">${Model.roleName}</span>
                        </div>
                       <div class="list">
                            <span class="title">评论数量：</span>
                            <span class="body">${Model.commentCount} 条</span>
                        </div>
                    <div class="list">
                        <span class="title">文档标签：</span>
                        <span class="body">${Model.label}</span>
                    </div>
                        <div class="summary">${Description} </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <#include "../widgets/footer.ftl">
</div>
<script src="${request.contextPath}/jquery/1.12.4/jquery.min.js"></script>
<script src="${request.contextPath}/bootstrap/js/bootstrap.min.js"></script>
<script src="${request.contextPath}/layer/layer.js"></script>
<script src="${request.contextPath}/js/main.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#btnRelease").on("click",function () {
            $.ajax({
                url : "{{urlfor "BookController.Release" ":key" .Model.Identify}}",
                data :{"identify" : "{{.Model.Identify}}" },
                type : "post",
                dataType : "json",
                success : function (res) {
                    if(res.errcode === 0){
                        layer.msg("发布任务已推送到任务队列，稍后将在后台执行。");
                    }else{
                        layer.msg(res.message);
                    }
                }
            });
        });

    });
</script>
</body>
</html>